package Practice;

import java.util.Scanner;

public class WordPaste {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        int boyCount = 0;
        int girlCount = 0;

        char[] a = input.toCharArray();
        //题目说“每个单词至少有一个字符没有被覆盖”，那么只要在这个单词的范围内，出现了这个单词的某个字母，就代表这个范围有一个单词
        for (int i = 0; i < input.length()-2; i++) {
            if (a[i] == 'b'||a[i+1] == 'o'||a[i+2] == 'y')
                boyCount++;

        }

        for (int i = 0; i < input.length()-3; i++) {
            if (a[i] == 'g'||a[i+1] == 'i'||a[i+2] == 'r'||a[i+3] == 'l')
                girlCount++;
        }

        System.out.println(boyCount);
        System.out.println(girlCount);
    }
}